Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster thinning implementation #3689

Merged
merged 2 commits into from
Mar 27, 2024
Merged

Conversation

LiuPeiqiCN
Copy link
Contributor

@LiuPeiqiCN LiuPeiqiCN commented Mar 8, 2024

This implement of cv::ximgproc::thinning achieves the same results as the original codes but with improvement in efficiency(10x speedup).

However, there are a few issues with this PR:

  • Loss of Code Readability: The implementation sacrifices code readability for performance. To mitigate this, I have retained the original code and commented it out, so it remains accessible for reference.

  • Lack of Expertise in OpenCV Development: The implementation may seem inelegant, I am uncertain whether this approach is good enough.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@asmorkalov asmorkalov self-requested a review March 26, 2024 09:35
@asmorkalov asmorkalov changed the title faster thinning implement Faster thinning implementation Mar 27, 2024
@asmorkalov
Copy link
Contributor

Performance numbers for i5-2500K CPU @ 3.30GHz and 16Gb RAM:

             Name of Test               4.x-1  patched-1 patched-1 
                                                             vs    
                                                           4.x-1   
                                                         (x-factor)
perf::ThinningPerfTest::(640x480, 0)   41.158    8.465      4.86   
perf::ThinningPerfTest::(640x480, 1)   43.940   11.518      3.81   
perf::ThinningPerfTest::(1280x720, 0)  139.823  29.285      4.77   
perf::ThinningPerfTest::(1280x720, 1)  157.953  41.959      3.76   
perf::ThinningPerfTest::(1920x1080, 0) 455.564  77.698      5.86   
perf::ThinningPerfTest::(1920x1080, 1) 486.440  115.236     4.22   

Copy link
Contributor

@asmorkalov asmorkalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@asmorkalov asmorkalov merged commit e0381f0 into opencv:4.x Mar 27, 2024
10 checks passed
@asmorkalov asmorkalov mentioned this pull request Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants